package com.itSession.cn.util;


import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author Jerry
 * @Classname CommonseUtils
 * @Date 2019/3/11 10:48
 */
public class CommonseUtils {


    /**
     * 时间格式化
     * @return
     */
    public static String nowTime() {
        String dateStr = "";
        SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
        dateStr = format.format(new Date(System.currentTimeMillis()));

        return dateStr;
    }
    /**
     * 随机数产生
     *
     * @param age 随机数位数
     * @return
     */
    public static String tool(int age) {

        int i = (int) Math.pow(10, age);
        long rand = Math.round(Math.random() * i + 1);
        String result = String.format("%1$0" + age + "d", rand);
        return result;
    }
}
